<template>
  <!-- 公司双优化累计完成情况-->
  <div class="schemeApproval">
    <title-name title="公司双优化累计完成情况" style="margin-top: 50px"></title-name>
    <a-spin :spinning="loading">
      <div class="table-div">
        <a-table :columns="columns" bordered :pagination="false" :data-source="dataTable"> </a-table>
      </div>
    </a-spin>
  </div>
</template>
<script>
import {queryOptimizeList} from '@/api/design/monthlyReport/monthlyWorkReport'
export default {
  name: 'a' + Date.now(),
  props: {
    id: {
      type: String,
      default() {
        return ''
      }
    }
  },
  data() {
    this.columns = [
    {
       title: '序号',width: '80px',
       customRender(text, record, index) {
       return index + 1
      },
      width: '4%'
     },
      { title: '分公司', dataIndex: 'branchCompany', align: 'center', width: '10%' },
      { title: '项目名称', dataIndex: 'projectName', align: 'center', width: '10%' },
      {
        title: '立项数量',
        dataIndex: 'confessUserName',
        align: 'center',
        width: '12%',
        children: [
          {
            title: '设计',
            dataIndex: 'projectDesignNum',
            align: 'center'
          },
          {
            title: '方案',
            dataIndex: 'projectProgramNum',
            align: 'center'
          }
        ]
      },
      {
        title: '立项金额',
        dataIndex: 'confessUserName2',
        align: 'center',
        width: '12%',
        children: [
          {
            title: '设计',
            dataIndex: 'projectDesignAmount',
            align: 'center'
          },
          {
            title: '方案',
            dataIndex: 'projectProgramAmount',
            align: 'center'
          }
        ]
      },
      {
        title: '实施数量',
        dataIndex: 'confessUserName3',
        align: 'center',
        width: '12%',
        children: [
          {
            title: '设计',
            dataIndex: 'effectDesignNum',
            align: 'center'
          },
          {
            title: '方案',
            dataIndex: 'effectProgramNum',
            align: 'center'
          }
        ]
      },
      {
        title: '实施金额',
        dataIndex: 'confessUserName4',
        align: 'center',
        width: '12%',
        children: [
          {
            title: '设计',
            dataIndex: 'effectDesignAmount',
            align: 'center'
          },
          {
            title: '方案',
            dataIndex: 'effectProgramAmount',
            align: 'center'
          }
        ]
      },
      { title: '项目实际已完成产值', dataIndex: 'realityAmount', align: 'center', width: '7%',
        customRender(text, record, index) {
          let str = text!=null?text + '万元':'';
           return str
          }
       },
      { title: '项目总自施合同额', dataIndex: 'owerContranctAmount', align: 'center', width: '7%',
       customRender(text, record, index) {
        let str = text!=null?text + '万元':'';
           return str
        }},
      { title: '累计完成优化目标占比A（%）立项额/已完成产值', dataIndex: 'optimizationARate', align: 'center', width: '7%' },
      { title: '累计完成优化目标占比B（%）立项额/自施合同额', dataIndex: 'optimizationBRate', align: 'center', width: '7%' }
    ]
    return {
      loading: false,
      dataTable: []
    }
  },
  watch: {
    id: {
      handler(val) {
        this.queryOptimizeListFn(val)
      },
      immediate: true
    }
  },
  methods: {
    queryOptimizeListFn(id){
      this.loading = true;
      queryOptimizeList({id:id}).then((res)=>{
        if(res.code == '200'){
          this.loading = false;
          this.dataTable = res.data;
        }
      }).catch(() => {
          this.loading = false
          this.$message.warning(err.data.message)
        })
    }
  },
  mounted() {}
}
</script>
<style lang="less" scoped>
   ::v-deep.titleName{
    margin-top:10px!important;
  }

</style>
  
      